const express = require('express');
const cors = require('cors')




const app = express();
app.use(cors())
app.use(express.json())
// 解析表单请求中间件
app.use(express.urlencoded({ extended: true }))

// 定义一个获取接口请求信息的全局中间件
function printTime(req,res,next){
    console.log(new Date().toLocaleString(),req.method,req.url);
    // 中间件一定要调用 next
    next()
}
app.use(printTime)


const loginRouter = require('./router/login')
const mallRouter = require('./router/mall')
const customerRouter = require('./router/customer')
app.use('/login',loginRouter)
app.use('/mall',mallRouter)
app.use('/customer',customerRouter)
// const uploadItems = require('./controller/upload')
// app.use('/picServer',uploadItems)


app.listen(8090, () => {
    console.log('服务器已经启动');
})